package com.itlin.service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;

import com.itlin.bean.User;
import com.itlin.dao.UserDao;
import com.itlin.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Transactional
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;
    /**
     * @param phone
     * @return
     */
    @Override
    public User findUserByPhone(String phone) {
        LambdaQueryWrapper<User> qw = new LambdaQueryWrapper<>();
        qw.eq(User::getPhone , phone);
        qw.eq(User::getStatus , 1 );
        return userDao.selectOne(qw);
    }

    @Override
    public void add(User user) {
        userDao.insert(user);
    }

}
